package SV_CSRF_ORIGIN;

public class Fixed {
    void doPost(HttpServletRequest req, HttpServletResponse resp) {
        String origin = req.getHeader("Origin");
        if(isSameOriginRequest(origin)) {
            String action = req.getParameter("action");
            String id = req.getParameter("id");

            if ("update".equals(action)) {
                updateUser(id, req);
            }
        }
        //...
    }

    void updateUser(String userid, HttpServletRequest req) {
        //...
    }
}
